/**
 * 
 */
package com.baijia.tianxiao.push.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author leiruiqi
 * 
 * 设备类型
 *
 */
public enum DeviceTypeEnum {

	ANDROID("1"),
	IOS("2"),
	
	;
	private String code;
	
	public String getCode() {
		return code;
	}
	private DeviceTypeEnum(String code) {
		this.code = code;
	}

	public static DeviceTypeEnum getByName(String name){
		for(DeviceTypeEnum type:DeviceTypeEnum.values()){
			if(StringUtils.equals(name, type.name())){
				return type;
			}
		}
		return null;
	}
	
	public static DeviceTypeEnum getByCode(String code){
		for(DeviceTypeEnum type:DeviceTypeEnum.values()){
			if(StringUtils.equals(code, type.getCode())){
				return type;
			}
		}
		return null;
	}
}
